package org.java.vm.command;

import java.util.Arrays;
import java.util.List;

public class Sub implements ArithmeticCommand {
    private final ArithmeticHandler arithmeticHandler;

    public Sub(ArithmeticHandler arithmeticHandler) {
        this.arithmeticHandler = arithmeticHandler;
    }

    @Override
    public List<String> calculate() {
        return arithmeticHandler.operateTwoDigit(Arrays.asList("D=M-D"));
    }

    @Override
    public boolean canCalculate(String command) {
        return command.equalsIgnoreCase("SUB");
    }
}
